﻿using System;
using NUnit.Framework;
using SpecFlowTfsLinker.Printer;
using SpecFlowTfsLinker.Test.Common;

namespace SpecFlowTfsLinker.Test.Printer
{
    [TestFixture]
    public class ParameterPrinterTest : TestInitialization
    {
        private static void AssertTypePrinter(string sourceParameter, string stringType, Type type)
        {
            var intPrinter = new ParameterPrinter(sourceParameter);
            Assert.That(intPrinter.DisplayType, Is.EqualTo(stringType));
            Assert.That(intPrinter.Type, Is.EqualTo(type));
            Assert.That(intPrinter.Parameter, Is.EqualTo(sourceParameter));
        }

        [Test]
        public void CanPrintBoolParameter()
        {
            AssertTypePrinter("True", "bool", typeof (bool));
            AssertTypePrinter("False", "bool", typeof (bool));
        }

        [Test]
        public void CanPrintDateTimeParameter()
        {
            AssertTypePrinter("28/12/2011", "DateTime", typeof (DateTime));
            AssertTypePrinter("2011/12/28", "DateTime", typeof (DateTime));
        }

        [Test]
        public void CanPrintFloatParameter()
        {
            AssertTypePrinter("123.45", "float", typeof (float));
            AssertTypePrinter("123,45", "float", typeof (float));
        }

        [Test]
        public void CanPrintIntParameter()
        {
            AssertTypePrinter("123", "int", typeof (int));
        }

        [Test]
        public void CanPrintStringParameter()
        {
            AssertTypePrinter("Patriiiick", "string", typeof (string));
        }
    }
}